function sleep(n)
{
    var   start=new   Date().getTime();
    while(true)   if(new   Date().getTime()-start> n)   break;
}
sleep(5000);
alert(1);